<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .p01{
            width:200px;
            height:100px;
            background-color:green;
        }
    </style>
</head>

<body>
    <div id="box">

    </div>
  
    <script src="./js/react18.js"></script>
    <script src="./js/react-dom18.js"></script>
    <script src="./js/babel.min.js"></script>
    
    <script type="text/babel">

        // 创建一个根对象：
        let root = ReactDOM.createRoot(document.getElementById("box"));



        let  count = 2;

        let s = {
            width:"200px",
            heigh:"100px",
            backgroundColor:"red"
        }

        const classStr = "p01";
        
        const jsx = (<div>
                        <h2>标题2：</h2>
                        {/*style属性只能使用对象*/}
                        <p style={s}>我是个p：{count}</p>
                        <p style={{backgroundColor:"blue"}}>我是个p：{count}</p>
                        
                        {/*class属性需要改成className*/}
                        <p className="p01" ></p>
                        <p className={classStr} ></p>
                        <input type="radio" id="nan" name="sex" /><label htmlFor="nan">男</label>
                        <input type="radio" id="nv" name="sex" /><label htmlFor="nv">女</label>

                    </div>);
        
        console.log("jsx",jsx);//jsx就是虚拟dom


        // 把jsx渲染到根对象对应的dom容器里
        root.render(jsx);
        

    </script>
</body>

</html>